package hao.bk.utils;

import java.text.Collator;
import java.util.Locale;

import android.content.Context;
import android.content.res.Resources;
import hao.bk.royalmap.RoyalMapActivity;


/**
 * Lớp tiện ích, dùng để xử lý các chức năng chung 
 * 
 * @author haoDV
 * 
 */

public class Utils {
	
	private static Context mContext = RoyalMapActivity.getInstance();
	
	public static int compareStringUTF8(String first, String seconds) {
		Locale locale = Locale.getDefault();
		Collator collator = Collator.getInstance(locale);
		return collator.compare(first, seconds);
	}
	
	/**
	 * Hàm này lấy chuỗi trong file String
	 * 
	 * @param resId
	 * @return
	 */
	public static String getString(int resId) {
		return mContext.getResources().getString(resId);
	}
		
	public static int getStatusBarHeight() {
		int result = 0;
		int resourceId = mContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
		if (resourceId > 0) {
			result = mContext.getResources().getDimensionPixelSize(resourceId);
		}
		return result;
	}
	
	public static int getNavigationBarHeight() {
		int result = 0;
		Resources resources = mContext.getResources();
		int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
		if (resourceId > 0) {
			result = resources.getDimensionPixelSize(resourceId);
		}
		return result;
	}
}
